home *** CD-ROM | disk | FTP | other *** search
- on mouseUp
- -- process makeIt command -- create the DB
- case (the frameLabel) of
- "create":
- FFCreateDatabase
- "index":
- FFCreateIndex
- end case
- end
-
- on mouseDown
- set the castNum of sprite 17 to (the number of cast "makeItDown")
- updateStage
- repeat while the mouseDown is true
- -- wait for the mouse to go up
- end repeat
- set the castNum of sprite 17 to (the number of cast "makeItUp")
- updateStage
- end mouseUP
-
- on FFCreateDatabase
- global baseSprite
- cursor 4
- if field "masterTypeList" = EMPTY then
- cursor -1
- BadCreateAlert
- exit
- end if
-
- put fileIO(mNew,"?write","") into theFileIO
- if theFileIO < 0 then exit
- put theFileIO(mFileName) into fspec
- put theFileIO(mDelete) -- should dispose of the FileIO instance
-
- -- build the DB expression
- put EMPTY into schema
- repeat with i = 1 to the number of lines of field "masterTypeList"
- put line i of field "masterNameList" & "," into theLine
- case (line i of field "masterTypeList") of
- "character":
- put theLine & "C," into theLine
- put theLine & string(line i of field "masterWidthList") into theLine
- "numeric":
- put theLine & "N," into theLine
- put theLine & string(line i of field "masterWidthList") & "," into theLine
- put theLine & string(line i of field "masterDecimalsList") into theLine
- "logical":
- put theLine & "L" into theLine
- "date":
- put theLine & "D" into theLine
- "memo":
- put theLine & "M" into theLine
- end case
- if schema <> EMPTY then put schema & RETURN into schema
- put schema & theLine into schema
- end repeat
-
- put DBOpenSession() into DBResult
- if DBResult < 0 then
- cursor -1
- BadCreateAlert
- exit
- end if
-
- put DBCreate(fspec,the number of lines of schema,schema,"false") into DBResult
- if DBResult < 0 then
- cursor -1
- BadCreateAlert
- exit
- end if
-
- put DBCloseSession() into DBResult
- if DBResult < 0 then
- cursor -1
- BadCreateAlert
- exit
- end if
-
- closeCreate
- initCreate -- do we go to another screen??
- cursor -1
- GoodCreateAlert -- We did it!!
- end FFCreateDatabase
-
- on BadCreateAlert
- global baseSprite
- -- show the Good dialog
- locShow baseSprite
- set the castNum of sprite (baseSprite+1) to (the number of cast "DBCreateBad")
- locShow baseSprite+1
- set the castNum of sprite (baseSprite+3) to (the number of cast "UpOKDBCreateAlert")
- locShow baseSprite+3
- updateStage
- end BadCreateAlert
-
- on GoodCreateAlert
- global baseSprite
- -- show the Good dialog
- locShow baseSprite
- set the castNum of sprite (baseSprite+1) to (the number of cast "DBCreateGood")
- locShow baseSprite+1
- set the castNum of sprite (baseSprite+3) to (the number of cast "UpOKDBCreateAlert")
- locShow baseSprite+3
- updateStage
- end GoodCreateAlert
-
- on FFCreateIndex
- global baseSprite, indexDBFile
-
- cursor 4
- if field "indexExpr" = EMPTY then
- cursor -1
- BadIndexAlert
- exit
- end if
-
- put fileIO(mNew,"?write","") into theFileIO
- if theFileIO < 0 then exit
- put theFileIO(mFileName) into fspec
- put theFileIO(mDelete) -- should dispose of the FileIO instance
-
- -- build the DB expression
- put EMPTY into expr
- repeat with i = 1 to the number of chars of field "indexExpr"
- put char i of field "indexExpr" into theC
- if theC <> RETURN and theC <> " " then
- put expr & theC into expr
- end if
- end repeat
-
- put DBOpenSession() into DBResult
- if DBResult < 0 then
- cursor -1
- BadIndexAlert
- exit
- end if
-
- put DBUse(indexDBFile) into DBResult
- if DBResult < 0 then
- cursor -1
- BadIndexAlert
- exit
- end if
-
- put DBCreateIndex(fspec,expr,"0","0") into DBResult
- if DBResult < 0 then
- cursor -1
- BadIndexAlert
- exit
- end if
-
- put DBCloseSession() into DBResult
- if DBResult < 0 then
- cursor -1
- BadIndexAlert
- exit
- end if
-
- put EMPTY into field "indexExpr" -- do we go to another screen??
- cursor -1
- GoodIndexAlert -- We did it!!
- end FFCreateIndex
-
- on BadIndexAlert
- global baseSprite
- -- show the Good dialog
- locShow baseSprite
- set the castNum of sprite (baseSprite+1) to (the number of cast "DBCreateIndexBad")
- locShow baseSprite+1
- set the castNum of sprite (baseSprite+3) to (the number of cast "UpOKDBCreateAlert")
- locShow baseSprite+3
- updateStage
- end BadIndexAlert
-
- on GoodIndexAlert
- global baseSprite
- -- show the Good dialog
- locShow baseSprite
- set the castNum of sprite (baseSprite+1) to (the number of cast "DBCreateIndexGood")
- locShow baseSprite+1
- set the castNum of sprite (baseSprite+3) to (the number of cast "UpOKDBCreateAlert")
- locShow baseSprite+3
- updateStage
- end GoodIndexAlert
-